//
// Created by xiaoma on 1/27/21.
//

#ifndef HORSE_VM_BUFFEREDINPUTSTREAM_H
#define HORSE_VM_BUFFEREDINPUTSTREAM_H

#include <cstdio>

#define BUFFER_LEN 256

class BufferedInputStream {
public:
    BufferedInputStream(const char *fileName);

    ~BufferedInputStream();

    char read();

    int readInt();

    void unread();

private:
    FILE *fp;
    char buffer[BUFFER_LEN];
    unsigned short index;
};

#endif //HORSE_VM_BUFFEREDINPUTSTREAM_H
